package coml.jiyun.hp.gjtk_e;

import android.os.Bundle;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import androidx.appcompat.app.AppCompatActivity;
import org.greenrobot.eventbus.EventBus;
import org.greenrobot.eventbus.Subscribe;
import org.greenrobot.eventbus.ThreadMode;

public class Main2Activity extends AppCompatActivity {

    private WebView mWeb;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main2);
        initView();
        EventBus.getDefault().register(this);
    }

    private void initView() {
    //    mWeb = (WebView) findViewById(R.id.web);
    }

    @Subscribe(threadMode = ThreadMode.MAIN,sticky = true)
    public void eventbus(MyEventBus myEventBus){
        WebView webView = new WebView(this);

        webView.loadUrl(myEventBus.link);
        webView.setWebViewClient(new WebViewClient());
        setContentView(webView);

    }

    @Override
    protected void onDestroy() {
        super.onDestroy();
        EventBus.getDefault().unregister(this);
    }
}
